package com.wenx.v3system.modular.cloud.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wenx.v3system.modular.cloud.domain.po.SysUserRole;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;

public interface SysUserRoleMapper extends BaseMapper<SysUserRole> {
    
    /**
     * 物理删除用户角色关联（绕过逻辑删除）
     * @param userId 用户ID
     * @return 删除记录数
     */
    @Delete("DELETE FROM sys_user_role WHERE user_id = #{userId}")
    int physicalDeleteByUserId(@Param("userId") Long userId);
    
    /**
     * 物理删除用户角色关联（绕过逻辑删除）
     * @param userId 用户ID
     * @param roleId 角色ID
     * @return 删除记录数
     */
    @Delete("DELETE FROM sys_user_role WHERE user_id = #{userId} AND role_id = #{roleId}")
    int physicalDeleteByUserIdAndRoleId(@Param("userId") Long userId, @Param("roleId") Long roleId);
}